// 共用体

#include <stdio.h>
#include <string.h>

union Data
{
    int i;
    float f;
    char str[20];
};

int main()
{
    union Data data;

    printf("Memory size occupied by data : %d\n", sizeof(data));

    union Data data1;
    data1.i = 10;
    data1.f = 20.1;
    strcpy(data1.str, "data1_str");

    printf("data1.i : %d\n", data1.i);
    printf("data1.f : %f\n", data1.f);
    printf("data1.str : %s\n", data1.str);

    return 0;
}